// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.
//
// ███╗   ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
// ████╗  ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
// ██╔██╗ ██║██║   ██║   ██║   ██║██║     █████╗
// ██║╚██╗██║██║   ██║   ██║   ██║██║     ██╔══╝
// ██║ ╚████║╚██████╔╝   ██║   ██║╚██████╗███████╗
// ╚═╝  ╚═══╝ ╚═════╝    ╚═╝   ╚═╝ ╚═════╝╚══════╝
// ------------------------------------------------
//
// This file is automatically generated.
// Please do not edit these files manually.
//
// ------------------------------------------------

#nullable restore

using Elastic.Clients.Elasticsearch.Fluent;
using Elastic.Clients.Elasticsearch.Requests;
using Elastic.Clients.Elasticsearch.Serialization;
using Elastic.Transport;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Text.Json;
using System.Text.Json.Serialization;

namespace Elastic.Clients.Elasticsearch.MachineLearning;

public sealed partial class RevertModelSnapshotRequestParameters : RequestParameters
{
}

/// <summary>
/// <para>Reverts to a specific snapshot.<br/>The machine learning features react quickly to anomalous input, learning new<br/>behaviors in data. Highly anomalous input increases the variance in the<br/>models whilst the system learns whether this is a new step-change in behavior<br/>or a one-off event. In the case where this anomalous input is known to be a<br/>one-off, then it might be appropriate to reset the model state to a time<br/>before this event. For example, you might consider reverting to a saved<br/>snapshot after Black Friday or a critical system failure.</para>
/// </summary>
public sealed partial class RevertModelSnapshotRequest : PlainRequest<RevertModelSnapshotRequestParameters>
{
	public RevertModelSnapshotRequest(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id snapshotId) : base(r => r.Required("job_id", jobId).Required("snapshot_id", snapshotId))
	{
	}

	internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningRevertModelSnapshot;

	protected override HttpMethod StaticHttpMethod => HttpMethod.POST;

	internal override bool SupportsBody => true;

	internal override string OperationName => "ml.revert_model_snapshot";

	/// <summary>
	/// <para>Refer to the description for the `delete_intervening_results` query parameter.</para>
	/// </summary>
	[JsonInclude, JsonPropertyName("delete_intervening_results")]
	public bool? DeleteInterveningResults { get; set; }
}

/// <summary>
/// <para>Reverts to a specific snapshot.<br/>The machine learning features react quickly to anomalous input, learning new<br/>behaviors in data. Highly anomalous input increases the variance in the<br/>models whilst the system learns whether this is a new step-change in behavior<br/>or a one-off event. In the case where this anomalous input is known to be a<br/>one-off, then it might be appropriate to reset the model state to a time<br/>before this event. For example, you might consider reverting to a saved<br/>snapshot after Black Friday or a critical system failure.</para>
/// </summary>
public sealed partial class RevertModelSnapshotRequestDescriptor : RequestDescriptor<RevertModelSnapshotRequestDescriptor, RevertModelSnapshotRequestParameters>
{
	internal RevertModelSnapshotRequestDescriptor(Action<RevertModelSnapshotRequestDescriptor> configure) => configure.Invoke(this);

	public RevertModelSnapshotRequestDescriptor(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id snapshotId) : base(r => r.Required("job_id", jobId).Required("snapshot_id", snapshotId))
	{
	}

	internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningRevertModelSnapshot;

	protected override HttpMethod StaticHttpMethod => HttpMethod.POST;

	internal override bool SupportsBody => true;

	internal override string OperationName => "ml.revert_model_snapshot";

	public RevertModelSnapshotRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id jobId)
	{
		RouteValues.Required("job_id", jobId);
		return Self;
	}

	public RevertModelSnapshotRequestDescriptor SnapshotId(Elastic.Clients.Elasticsearch.Id snapshotId)
	{
		RouteValues.Required("snapshot_id", snapshotId);
		return Self;
	}

	private bool? DeleteInterveningResultsValue { get; set; }

	/// <summary>
	/// <para>Refer to the description for the `delete_intervening_results` query parameter.</para>
	/// </summary>
	public RevertModelSnapshotRequestDescriptor DeleteInterveningResults(bool? deleteInterveningResults = true)
	{
		DeleteInterveningResultsValue = deleteInterveningResults;
		return Self;
	}

	protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings)
	{
		writer.WriteStartObject();
		if (DeleteInterveningResultsValue.HasValue)
		{
			writer.WritePropertyName("delete_intervening_results");
			writer.WriteBooleanValue(DeleteInterveningResultsValue.Value);
		}

		writer.WriteEndObject();
	}
}